const path = require('path')
const vuxLoader = require('vux-loader')

function resolve(dir) {
  return path.join(__dirname, dir)
}

module.exports = {
  publicPath: '/kui/',
  productionSourceMap: false,
  /**
   * Type: Object
   * 所有webpack-dev-server的选项都支持
   * 有些值像host、port和https可能会被命令行参数覆写
   * 有些像publicPath和historyApiFallback不应该被修改，因为它们需要和开发服务器的baseUrl同步以保障正常工作
   */
  devServer: {
    port: 8080, //项目端口
    disableHostCheck: true, //关闭host检测(配置了这个才可以通过域名访问)
  },

  configureWebpack: config => {
    // vuxLoader.merge(config, {
    //   options: {},
    //   plugins: ['vux-ui']
    // })
  },

  chainWebpack: config => {
    //路径别名
    config.resolve.alias
      .set('@', resolve('src'))
      .set('@css', resolve('src/assets/css'))
      .set('@img', resolve('src/assets/image'))
      .set('@bApi', resolve('src/baseApi'))
      .set('@cps', resolve('src/components'))
      .set('@view', resolve('src/views'))
  },
  css: {
    loaderOptions: {
      less: {
        javascriptEnabled: true
      }
    }
  }
}